class AuthapiController < ActionController::Base
	def logon
		username = params[:username]
		password = params[:password]
		user = User.where("name = ? and password = ?", username, password).first;
		if user != nil
			reset_session
			session[:user_id] = user.id
			temp = '{"success": true}'
			render :json => temp
		else
			temp = '{"success": false, "errorinfo": "用户名密码错误"}'
			render :json => temp
		end
	end
end
